#ifndef __TASK_MANAGER_H
#define __TASK_MANAGER_H
#include <sys/types.h>
#include <pthread.h>


#define MAX_RESTARTS    3

//任务接口
typedef struct {
    int id;
    const char *name;
    const char *program_path;
    pid_t pid;
    int restart_count;
} Task;
extern pthread_mutex_t task_mutex;

void task_manager_init(void);
int start_task(int task_id, char **args);
int stop_task(int task_id);
int stop_all_tasks(void);
void monitor_tasks(void);
Task* get_task_list(int *count);
Task* get_task_by_id(int task_id);

#endif